package com.powerunion.datacollection.persistence.pagination;

import java.util.*;

public class PageResult {
  /**
   * 当前页号
   */
  private int curPageNumber;
  private int nextPageNumber;
  private int prePageNumber;
  private int pageAmount;
  private int curPos;
  /**
   * 当前页面大小
   */
  private int curPageSize;
  private int recordAmount;
  public PageResult() {
    this.sqlResultSet = new ArrayList();
  }

  /**
   * 获取当前页面的数据集
   *
   * @return List
   */
  public List getSqlResultSet() {
    return sqlResultSet;
  }

  /**
   * 获取当前页号
   *
   * @return int
   */
  public int getCurPageNumber() {
    return curPageNumber;
  }

  /**
   * 获取当前页面大小
   *
   * @return int
   */
  public int getCurPageSize() {
    return curPageSize;
  }

  /**
   * 获取总记录数
   *
   * @return int
   */
  public int getRecordAmount() {
    return recordAmount;
  }

  /**
   * 获取下一页的页号
   *
   * @return int
   */
  public int getNextPageNumber() {
    return nextPageNumber;
  }

  /**
   * 获取总页数
   *
   * @return int
   */
  public int getPageAmount() {
    return pageAmount;
  }

  /**
   * 获取前页号
   *
   * @return int
   */
  public int getPrePageNumber() {
    return prePageNumber;
  }

  /**
   * 获取当前记录位置
   *
   * @return int
   */
  public int getCurPos() {
    return curPos;
  }

  /**
   * 首页页号，为常数1
   *
   * @return int
   */
  public int getFirstPageNumber() {
    return 1;
  }

  /**
   * 最后页号
   *
   * @return int
   */
  public int getLastPageNumber() {
    return pageAmount;
  }

  public void setSqlResultSet(List sqlResultSet) {
    if (sqlResultSet != null) {
      this.sqlResultSet.addAll(sqlResultSet);
    }
    //this.sqlResultSe = sqlResultSe.
  }

  public void setCurPageNumber(int curPageNumber) {
    this.curPageNumber = curPageNumber;
  }

  public void setCurPageSize(int curPageSize) {
    this.curPageSize = curPageSize;
  }

  public void setRecordAmount(int recordAmount) {
    this.recordAmount = recordAmount;
  }

  public void setNextPageNumber(int nextPageNumber) {
    this.nextPageNumber = nextPageNumber;
  }

  public void setPageAmount(int pageAmount) {
    this.pageAmount = pageAmount;
  }

  public void setPrePageNumber(int prePageNumber) {
    this.prePageNumber = prePageNumber;
  }

  public void setCurPos(int curPos) {
    this.curPos = curPos;
  }

  /**
   * 结果集列表
   */
  private List sqlResultSet;
  /**
   * 清除内存查询结果
   */
  public void clearAll() {
    if (!this.sqlResultSet.isEmpty()) {
      this.sqlResultSet.clear();
      this.sqlResultSet = null;
    }

  }
}
